#pragma once

#include "imgui/imgui.h"
#include "imgui/imgui_impl_glfw.h"
#include "imgui/imgui_impl_opengl3.h"
#include <stdio.h>
#define GL_SILENCE_DEPRECATION
#if defined(IMGUI_IMPL_OPENGL_ES2)
#include <GLES2/gl2.h>
#endif
#include <GLFW/glfw3.h>
#include "BS_thread_pool.hpp"

class Instance
{
public:
    virtual void Draw() = 0;
    static void Renderer();
};

class Application
{
public:
    enum ErrCode
    {
        OK,
        GLFW_INIT,
        GLFW_CREATE_WINDOW,
    };

    static Application &Instantiation();
    static ImGuiIO *GetIO();
    static ErrCode Init();
    static ErrCode Exec();
    static void Quit();

    void SetInstance(Instance *instance);

public:
    BS::light_thread_pool *ThreadPool;

private:
    GLFWwindow *MainWindow = nullptr;
    Instance *MainInstance = nullptr;
    ImGuiIO *Io = nullptr;
    bool is_done = false;

    friend void Instance::Renderer();
};